<template>
	<view class="themeItem">
		<navigator :url="`/pages/classlist/classlist?image=${image}&category=${category}`" class="box" v-if="!isMore && image">
			<image class="pic" :src="image" mode="aspectFill"></image>
			<view class="mask">{{ category || '未知分类' }}</view>
			<view class="tab">{{ updateTime || '未知时间' }}</view>
		</navigator>
		
		<!-- open-type="reLaunch" 实现跳转到导航栏tabbar的同一层级的“分类”页面，否则默认跳转到内页，如果不写会报错！-->
		<navigator url="/pages/classify/classify" open-type="reLaunch" class="box more" v-if="isMore">
			<image class="pic" src="/static/images/rw4.jpg" mode="aspectFill"></image>
			<view class="mask">
				<uni-icons type="more-filled" size="34" color="#fff"></uni-icons>
				<view class="text">更多</view>
			</view>			
		</navigator>
	</view>
</template>

<script setup>
	
//注意：想要让父级传过来的东西对子级进行修改，就需要在defineProps()里写值！而ref()是无法实现的！
defineProps({
	isMore:{
		type:Boolean,
		default:false
	},
	image:{
		type: String,
		required: true
	},
	category:{
		type: String,
		required: true
	},
	updateTime:{
		type: String,
		required: true
	}
	
})
</script>

<style lang="scss" scoped>
.themeItem{
	.box{
		height: 340rpx;
		border-radius: 10rpx;
		overflow: hidden;
		position: relative;//相对定位
		.pic{
			width: 100%;
			height: 100%;
		}
		.mask{
			width: 100%;
			height: 70rpx;
			position: absolute;//绝对定位
			bottom: 0;
			left: 0;
			background: rgba(0, 0, 0, 0.2);
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			backdrop-filter: blur(15rpx);//磨砂玻璃效果
			font-weight: 600;//字体加粗
			font-size: 30rpx;
		}
		.tab{
			position: absolute;
			left: 0;
			top: 0;
			background: rgba(250,129,90,0.7);
			backdrop-filter: blur(20rpx);
			color: #fff;
			font-size: 22rpx;
			padding: 6rpx 14rpx;
			border-radius: 0 0 20rpx 0;
			transform: scale(0.8);//文字缩小
			transform-origin: left top;
		}
	}
	
	.box.more{
		.mask{
			width: 100%;
			height: 100%;
			flex-direction: column;
		}
		.text{
			font-size: 28rpx;
			
		}
	}
}
</style>